package cn.ml.chuji.oop.toString;


import cn.ml.entity.Student;

import java.math.BigDecimal;
import java.time.LocalDate;

public class Undergraduate extends Student {
    public String degrre;

    public Undergraduate(int id, String name, String sex, Integer age, Double height, LocalDate birthday, BigDecimal property, String degrre) {
        super(id, name, sex, age, height, birthday, property);
        this.degrre = degrre;
    }


    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((degrre == null) ? 0 : degrre.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Undergraduate other = (Undergraduate) obj;
        if (degrre == null) {
            if (other.degrre != null)
                return false;
        } else if (!degrre.equals(other.degrre))
            return false;
        return true;
    }


    @Override
    public String toString() {
        return "degrre=" + degrre + ", name=" + super.getName() + ", age=" + super.getAge() + "";
    }

    public void show() {
        System.out.println(super.getName() + "," + degrre + "," + super.getAge());

    }
}

